package aad.storyboard.view;

import java.util.Observable;
import java.util.Observer;

import aad.storyboard.model.Story;
import aad.storyboard.model.StorySettings;
import aad.storyboard.model.menu.MenuItem;
import android.content.Context;
import android.widget.SeekBar;
import android.widget.ToggleButton;

public class StoryButton extends ToggleButton implements Observer{

	private Integer tag;
	private StorySettings settings;
	
	public StoryButton(Context context, Integer tag) {
		super(context);
		this.tag = tag;
		this.settings = Story.getInstance().getSettings();
		this.settings.addObserver(this);
		// TODO Auto-generated constructor stub
	}
	
	@Override
	public void update(Observable observable, Object data) {
		if(this.tag.intValue() == MenuItem.WIKI){
			this.setChecked(settings.isWikiMode());
		}
		else if(this.tag.intValue() == MenuItem.SCRIPT){
			this.setChecked(settings.isScripts());
		}
		this.invalidate();
	}
	
	

}
